Fix migration to actually do the right thing

Glenn 'devalias' Grant 10 years ago
parent
commit
b2fbf70723
1 changed files with 4 additions and 4 deletions
  1. 4 4
      db/migrate/20140603104211_rename_digest_email_to_email_digest.rb

+ 4 - 4
db/migrate/20140603104211_rename_digest_email_to_email_digest.rb

@@ -2,8 +2,8 @@ class RenameDigestEmailToEmailDigest < ActiveRecord::Migration
2 2
   def up
3 3
     sql = <<-SQL
4 4
       UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')}
5
-      SET #{ActiveRecord::Base.connection.quote_column_name('type')} = "EmailDigestAgent"
6
-      WHERE #{ActiveRecord::Base.connection.quote_column_name('type')} = "DigestEmailAgent"
5
+      SET #{ActiveRecord::Base.connection.quote_column_name('type')} = "Agents::EmailDigestAgent"
6
+      WHERE #{ActiveRecord::Base.connection.quote_column_name('type')} = "Agents::DigestEmailAgent"
7 7
     SQL
8 8
 
9 9
     execute sql
@@ -12,8 +12,8 @@ class RenameDigestEmailToEmailDigest < ActiveRecord::Migration
12 12
   def down
13 13
     sql = <<-SQL
14 14
       UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')}
15
-      SET #{ActiveRecord::Base.connection.quote_column_name('type')} = "DigestEmailAgent"
16
-      WHERE #{ActiveRecord::Base.connection.quote_column_name('type')} = "EmailDigestAgent"
15
+      SET #{ActiveRecord::Base.connection.quote_column_name('type')} = "Agents::DigestEmailAgent"
16
+      WHERE #{ActiveRecord::Base.connection.quote_column_name('type')} = "Agents::EmailDigestAgent"
17 17
     SQL
18 18
 
19 19
     execute sql